import React ,{useState}from 'react'
import useStore from '../context/useStore'
const Login:React.FC=()=>{
    let [phone, setPhone] = useState<string>('');
    let [code, setCode] = useState<string>('');
    let {mine}=useStore()
     //点击发送验证码
     async function sendCode(){
        console.log('phone...', phone);
        if (/\d{11}/.test(phone)){
           let result = await mine.sendCode(phone);
        }
    }
    //点击修改手机号
    async function change() {
        
    }
    return <div>
        <div>
                <input type="number" placeholder="请输入您的手机号" value={phone} onChange={e=>setPhone(e.target.value)}/>
            </div>
          
            <div>
                <input type="number" maxLength={6} placeholder="请输入手机号验证码"  value={code} onChange={e=>setCode(e.target.value)}/>     
            </div>
            <button onClick={sendCode}>发送验证码</button>
            <button onClick={change}>修改手机号</button>
    </div>
}
export default Login